﻿@using WB.Core.BoundedContexts.Designer.Resources
@using WB.Core.BoundedContexts.Designer.Views.Questionnaire.Pdf
@using WB.UI.Designer.Utils
@model WB.Core.SharedKernels.QuestionnaireEntities.IVariable

@{
    PdfQuestionnaireModel questionnaire = ViewBag.Questionnaire;
    var variable = Model!;
}

<div class="question-container" id="@questionnaire.GetItemRef(variable.PublicKey)">
    <div class="question">
        <div class="question-title"><div class="type">@PdfStrings.Variable</div></div>
        <div class="common-info">
            <div class="variable-expression">
                @questionnaire.GetVariableExpressionExcerpt(variable)
                @if (questionnaire.VariableExpressionIsTooLong(variable))
                {
                    <div class="more">
                        <a href="#@questionnaire.GetVariableRef(variable.PublicKey)">
                            @Pdf.Format(PdfStrings.AppendixLink, variable.Expression.Length - questionnaire.Settings.VariableExpressionExcerptLength, questionnaire.GetEntityIndexInAppendix(variable.PublicKey, "VE"))
                        </a>
                    </div>
                }
            </div>
        </div>
    </div>
    <div class="answer">
        <div class="question-meta">
            <div class="type">
                @questionnaire.GetFormattedVariableType(variable)
            </div>
            <div class="variable_name">@variable.Name</div>
        </div>
        @if (variable.DoNotExport)
        {
            <div class="answer-editor common-info">
                @PdfStrings.VariableExcludedFromExport
            </div>
        }
    </div>
</div>
